package com.fanxuankai.boot.monitor.prometheus;

import com.fanxuankai.boot.monitor.BaseMonitorProperties;
import com.fanxuankai.boot.monitor.autoconfigure.MonitorProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * @author fanxuankai
 */
@ConfigurationProperties(prefix = PrometheusProperties.PREFIX)
public class PrometheusProperties extends BaseMonitorProperties<PrometheusProperties.PrometheusConfig> {
    public static final String PREFIX = MonitorProperties.PREFIX + ".prometheus";

    public PrometheusProperties() {
        setTitle("Prometheus Metrics");
        setCron("0 0/5 * * * ?");
    }

    public static class PrometheusConfig {
        private String url;
        private List<Query> queries;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public List<Query> getQueries() {
            return queries;
        }

        public void setQueries(List<Query> queries) {
            this.queries = queries;
        }

        public static class Query {
            private String text;
            private float threshold;

            public String getText() {
                return text;
            }

            public void setText(String text) {
                this.text = text;
            }

            public float getThreshold() {
                return threshold;
            }

            public void setThreshold(float threshold) {
                this.threshold = threshold;
            }
        }
    }
}
